Skip to content

<fix>[kvm]: ZSTAC-85164 rename GC pool whitelist field#3965

Closed
zstack-robot-2 wants to merge 1 commit into
feature-5.5.6-local-cachefrom
sync/haidong.pang/fix/ZSTAC-85164@@3
Closed

<fix>[kvm]: ZSTAC-85164 rename GC pool whitelist field#3965
zstack-robot-2 wants to merge 1 commit into
feature-5.5.6-local-cachefrom
sync/haidong.pang/fix/ZSTAC-85164@@3

Conversation

@zstack-robot-2
Copy link
Copy Markdown
Collaborator

改动逻辑

  • 将 KVM agent GCPoolCmd 协议字段从 volumes 重命名为 whiteList,表达该列表是 GC 保留白名单。

sync from gitlab !9856

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

Review Change Stack

Walkthrough

在 GCPoolCmd 命令载荷中移除了公有字段 volumes(List),新增公有字段 inUseCacheUuids(List);其他成员未见语义变更。

变更清单

GCPoolCmd 字段替换

Layer / File(s) Summary
GCPoolCmd 字段替换 volumes -> inUseCacheUuids
plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java
移除 public List<VolumeTO> volumes;,新增 public List<String> inUseCacheUuids;

🎯 2 (Simple) | ⏱️ ~10 分钟

我是小兔来报喜,
一行字段换新姿,
UUID 列表轻轻来,
缓存标识更分明,
跳跃上线去巡礼 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed PR标题遵循了指定格式[scope]: ,长度为54字符,符合72字符限制,且准确概括了主要变更。
Description check ✅ Passed PR描述清晰地说明了改动逻辑,与实际代码变更相关联,包括字段重命名、类型变化和同步来源信息。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/haidong.pang/fix/ZSTAC-85164@@3

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java`:
- Line 5235: The field rename from volumes to whiteList in KVMAgentCommands
breaks backward compatibility; restore compatibility by preserving the old name:
add a backward-compatible alias for the field (e.g., annotate the new
List<VolumeTO> whiteList with a JSON alias for "volumes" or reintroduce a
volumes field and map it to whiteList), or use the project's `@GrayVersion`
pattern to mark the change for phased rollout; update the KVMAgentCommands class
to accept both "whiteList" and "volumes" during deserialization so mixed-version
agents/controllers keep the GC whitelist intact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml (via .coderabbit.yaml)

Review profile: CHILL

Plan: Pro

Run ID: 3ceed75f-fcb1-4522-8f61-426e83a7a727

📥 Commits

Reviewing files that changed from the base of the PR and between d396af8 and 9099d7c.

📒 Files selected for processing (1)
  • plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java

public String mountPoint;
public boolean force;
public List<VolumeTO> volumes;
public List<VolumeTO> whiteList;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 1) 检查 GCPoolCmd 在 Java 侧的构造与字段访问,确认是否仍有 volumes 依赖
rg -n -C3 --type=java '\bGCPoolCmd\b|\.whiteList\b|\.volumes\b'

# 2) 检查全仓库协议键使用,确认非 Java 端(例如脚本/agent)是否仍消费 "volumes"
rg -n -C2 "\"volumes\"|\"whiteList\"|'volumes'|'whiteList'"

Repository: MatheMatrix/zstack

Length of output: 5441


🏁 Script executed:

# Read the GCPoolCmd class definition to see the full structure
sed -n '5231,5245p' plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java

Repository: MatheMatrix/zstack

Length of output: 524


🏁 Script executed:

# Search for all usages of GCPoolCmd to see how it's being used
rg -n 'GCPoolCmd' --type=java -A 2 -B 2

Repository: MatheMatrix/zstack

Length of output: 527


🏁 Script executed:

# Check if there are any Python agent files that might reference "volumes" in GC context
find . -name "*.py" -o -name "*.sh" | xargs grep -l "volumes\|whiteList\|GCPool" 2>/dev/null | head -20

Repository: MatheMatrix/zstack

Length of output: 104


🏁 Script executed:

# Check the Python SDK backup file for any reference to GC or whiteList/volumes
cat testlib/src/main/resources/zssdk_bak.py | grep -i -C 5 "gc\|whitelist\|volumes" | head -50

Repository: MatheMatrix/zstack

Length of output: 963


🏁 Script executed:

# Search for GCPoolCmd instantiation and usage in Java code
rg -n 'new GCPoolCmd|GCPoolCmd\(' --type=java -A 5 -B 2

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Look for any agent-side code that handles protocol messages
find . -path "*/agent*" -name "*.py" | head -10

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Search for backwards compatibility patterns in the codebase (e.g., `@Deprecated` fields)
rg -n '@Deprecated' --type=java -B 2 -A 2 | head -50

Repository: MatheMatrix/zstack

Length of output: 4596


🏁 Script executed:

# Search for where GCPoolCmd objects are created or serialized/deserialized
rg -n 'GCPoolCmd' --type=java -B 5 -A 10 | head -100

Repository: MatheMatrix/zstack

Length of output: 1572


🏁 Script executed:

# Check if there's JSON serialization/deserialization of this command
rg -n 'whiteList|poolGc|gc.*cmd' -i --type=java | grep -i pool | head -20

Repository: MatheMatrix/zstack

Length of output: 186


🏁 Script executed:

# Look for any version compatibility or JSON field mapping annotations
rg -n '@JsonProperty|@SerializedName|@Deprecated' --type=java | grep -B 5 -A 5 'volumes\|whiteList' | head -50

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Search for KVM agent side code (if any Java-side marshalling happens)
find . -path "*kvm*" -name "*.py" | head -10

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Check git history to understand when this field was renamed and if volumes still exists in current branch
git log --oneline --all -- plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java | head -5

Repository: MatheMatrix/zstack

Length of output: 342


🏁 Script executed:

# Check the commit that renamed the field to understand the context
git show --stat 9099d7c08 | head -50

Repository: MatheMatrix/zstack

Length of output: 2775


🏁 Script executed:

# Search for all references to 'volumes' in the KVM plugin context
rg -n 'volumes' plugin/kvm/src/main/java/org/zstack/kvm/ --type=java | head -30

Repository: MatheMatrix/zstack

Length of output: 2006


🏁 Script executed:

# Look for where GCPoolCmd is instantiated or populated
rg -n 'GCPoolCmd\s*\(' -A 10 --type=java

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Check if agent code directory exists and has protocol definitions
find plugin/kvm -name "*agent*" -o -name "*protocol*" | head -20

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Search for any Java-to-agent communication code that might handle field mapping
rg -n 'toJson|fromJson|marshal|serialize' plugin/kvm/src/main/java/org/zstack/kvm/ --type=java | grep -i 'gc\|pool' | head -20

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Check the git diff of the commit that renamed the field
git show 9099d7c08 -- plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java | grep -A 20 -B 5 "GCPoolCmd"

Repository: MatheMatrix/zstack

Length of output: 1761


🏁 Script executed:

# Check if volumes field was actually deleted or just renamed
git show 9099d7c08:plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java | sed -n '5231,5245p'

Repository: MatheMatrix/zstack

Length of output: 524


🏁 Script executed:

# Check the previous commit to see what the old field was
git show 9099d7c08^:plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java 2>/dev/null | sed -n '5231,5245p' || echo "Cannot retrieve previous version"

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Search for any code that creates GCPoolCmd to see if they've been updated
rg -n 'new GCPoolCmd|GCPoolCmd\s*\{\s*' -A 10 --type=java

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Check if there are integration tests or code generators that might handle the old field
rg -n '"volumes"|\.volumes' plugin/kvm/ --type=java | grep -i 'gc\|pool'

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Check if the file was tracked before this commit
git log --all --oneline -- plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java | head -10

Repository: MatheMatrix/zstack

Length of output: 609


🏁 Script executed:

# Check what branches have the old "volumes" field in GCPoolCmd
git branch -a --contains 9099d7c08^

Repository: MatheMatrix/zstack

Length of output: 104


🏁 Script executed:

# Search for where GCPoolCmd whiteList is being set or used
rg -n 'whiteList' plugin/kvm/ --type=java -B 3 -A 3

Repository: MatheMatrix/zstack

Length of output: 739


🏁 Script executed:

# Check if there's any code that populates GCPoolCmd with data
rg -n 'GCPoolCmd' plugin/kvm/src/main/java/org/zstack/kvm/ --type=java -B 10 -A 5 | head -100

Repository: MatheMatrix/zstack

Length of output: 1574


🏁 Script executed:

# Look for the GC implementation to understand the context
rg -n 'class.*GC|gcPool|poolGc' plugin/kvm/ --type=java -i | head -20

Repository: MatheMatrix/zstack

Length of output: 898


🏁 Script executed:

# Check if whiteList is actually being used anywhere - setter or getter calls
rg -n 'whiteList|\.setWhiteList|\.getWhiteList' plugin/kvm/ --type=java -B 2 -A 2

Repository: MatheMatrix/zstack

Length of output: 509


🏁 Script executed:

# Look at GCPoolRsp to see if it mirrors the command
sed -n '5296,5310p' plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java

Repository: MatheMatrix/zstack

Length of output: 495


🏁 Script executed:

# Search for where GCPoolCmd is being sent or received in the KVM Host class
rg -n 'GCPoolCmd\|gcPool' plugin/kvm/src/main/java/org/zstack/kvm/KVMHost.java -B 5 -A 5

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Check the commit before the current GCPoolCmd history to see old field name
git log --all --oneline -- "plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java" | tail -5

Repository: MatheMatrix/zstack

Length of output: 275


🏁 Script executed:

# Look for any `@JsonAnySetter` or custom deserialization that might handle backward compatibility
rg -n '@JsonAnySetter|@JsonDeserialize|@JsonProperty' plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java -B 2 -A 2 | head -50

Repository: MatheMatrix/zstack

Length of output: 271


🏁 Script executed:

# Check AgentCommand class to understand `@JsonAnySetter` usage
rg -n 'class AgentCommand|@JsonAnySetter' plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java -B 5 -A 10 | head -60

Repository: MatheMatrix/zstack

Length of output: 1112


🏁 Script executed:

# Search for where GCPoolCmd is instantiated or populated
rg -n 'GCPoolCmd\s*\(\)|new GCPoolCmd' plugin/kvm/ --type=java -B 5 -A 10

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Look for code that sends GCPoolCmd to the agent
rg -n 'send.*GCPoolCmd|GCPoolCmd.*send' plugin/kvm/ --type=java -B 5 -A 5

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Check if there's an agent handler or any Python code that processes GCPoolCmd
find plugin/kvm -name "*.py" -exec grep -l "GCPool\|gc.*pool" {} \;

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Look at the test directory to see if there are integration tests for GCPoolCmd
find . -path "*/test*" -name "*.groovy" -o -name "*.java" | xargs grep -l "GCPool" 2>/dev/null | head -5

Repository: MatheMatrix/zstack

Length of output: 126


🏁 Script executed:

# Check what GrayUpgradeAgent does and if it provides backward compatibility
rg -n 'class GrayUpgradeAgent|@GrayVersion' core/src/ --type=java | head -30

Repository: MatheMatrix/zstack

Length of output: 161


🏁 Script executed:

# Look for GrayUpgradeAgent definition
find . -name "GrayUpgradeAgent.java" -o -name "GrayVersion.java" | head -5

Repository: MatheMatrix/zstack

Length of output: 191


🏁 Script executed:

# Check if `@GrayVersion` is used on GCPoolCmd or similar command classes
rg -n '@GrayVersion' plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java -B 2 -A 2 | head -50

Repository: MatheMatrix/zstack

Length of output: 1676


🏁 Script executed:

# Search for any backward compatibility patterns in the codebase related to field renaming
rg -n 'volumes.*whiteList|whiteList.*volumes' --type=java -B 5 -A 5

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Check if there's any documentation about the GC pool whitelist feature
rg -n 'ZSTAC-85164|85164' --type=groovy --type=java --type=java --type=md | head -20

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Read the GrayVersion and GrayUpgradeAgent classes to understand version compatibility
cat core/src/main/java/org/zstack/core/upgrade/GrayVersion.java

Repository: MatheMatrix/zstack

Length of output: 361


🏁 Script executed:

# Read the GrayUpgradeAgent class
cat core/src/main/java/org/zstack/core/upgrade/GrayUpgradeAgent.java

Repository: MatheMatrix/zstack

Length of output: 176


🏁 Script executed:

# Check if GCPoolCmd should have `@GrayVersion` annotation like other commands
sed -n '5230,5250p' plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java

Repository: MatheMatrix/zstack

Length of output: 657


🏁 Script executed:

# Look for any code that actually uses GCPoolCmd - check if it's being set
rg -n 'GCPoolCmd|gcPool' plugin/kvm/src/main/java/org/zstack/kvm/ --type=java -B 3 -A 3

Repository: MatheMatrix/zstack

Length of output: 721


🏁 Script executed:

# Check if `@JsonAnySetter` exists on AgentCommand or AgentResponse for backward compatibility
rg -n 'public static class AgentResponse|@JsonAnySetter' plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java -B 5 -A 15 | head -80

Repository: MatheMatrix/zstack

Length of output: 1394


🏁 Script executed:

# Look for any JSON field mapping or compatibility converters
rg -n '@JsonProperty|@JsonAlias|fieldNameStrategy' plugin/kvm/src/main/java/org/zstack/kvm/ --type=java

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Check if there's a base class that handles JSON deserialization
rg -n 'class GrayUpgradeAgent' -A 50 core/src/main/java/org/zstack/core/upgrade/GrayUpgradeAgent.java

Repository: MatheMatrix/zstack

Length of output: 100


🏁 Script executed:

# Look for any deserialization test or agent protocol tests
find . -path "*/test*" -name "*.groovy" | xargs grep -l "GCPool\|whiteList" 2>/dev/null | head -5

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Check if GCPoolCmd field is actually used/serialized anywhere
rg -n 'whiteList\s*=' plugin/kvm/ --type=java -B 5 -A 5

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Look for any code that creates or populates GCPoolCmd
rg -n 'poolUuid|mountPoint|whiteList' plugin/kvm/src/main/java/org/zstack/kvm/KVMHost.java -B 3 -A 3

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Check if the commit was a complete file addition or if it modified an existing file
git show 9099d7c08 --name-status | grep KVMAgentCommands

Repository: MatheMatrix/zstack

Length of output: 126


🏁 Script executed:

# Verify if this is truly the first commit for this file or if there are older versions
git log --all --follow plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java --oneline

Repository: MatheMatrix/zstack

Length of output: 128


🏁 Script executed:

# Check if any agent code actually processes this command
find plugin/kvm -name "*.py" -exec cat {} \; | grep -i "gc\|pool" | head -20

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Look at the full commit to see if there were other files modified that might show the old implementation
git show 9099d7c08 --stat | grep -E "\.java|\.py"

Repository: MatheMatrix/zstack

Length of output: 50375


🏁 Script executed:

# Check if there's any reference to the old "volumes" field in test files or agent code
find . -type f \( -name "*.py" -o -name "*.groovy" -o -name "*.java" \) -exec grep -l '"volumes".*pool\|pool.*"volumes"' {} \; 2>/dev/null | head -10

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Check if KVMAgentCommands.java is imported/used elsewhere
rg -n 'import.*KVMAgentCommands|GCPoolCmd' --type=java | head -20

Repository: MatheMatrix/zstack

Length of output: 2566


🏁 Script executed:

# Check if `@GrayVersion` annotation was used on the whiteList field
sed -n '5220,5240p' plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java

Repository: MatheMatrix/zstack

Length of output: 663


🏁 Script executed:

# Verify if there are any older branches or tags with the old "volumes" field in GCPoolCmd
git branch -r --contains 9099d7c08 | head -5

Repository: MatheMatrix/zstack

Length of output: 44


🏁 Script executed:

# Check if there's any mention of the old field name in documentation or comments
rg -n 'volumes.*pool|pool.*volumes|GC.*retain|retain.*list' --type=java --type=groovy -i | grep -i 'gc\|pool' | head -20

Repository: MatheMatrix/zstack

Length of output: 4377


协议字段改名未做兼容性处理,跨版本升级可能丧失数据

Line 5235 的 whiteList 字段直接改名,未保留向后兼容。在混合版本环境中(如灰度升级),若旧版管理节点或agent仍使用 volumes 字段名,新代码会无法识别该字段,导致GC池保留列表丢失,可能造成误删问题。

根据编码规范"向后兼容原则",应在至少一个兼容周期内保留旧字段,可参考同文件中 @GrayVersion 的使用模式。建议:

  • 添加 @GrayVersion 注解标记字段版本,或
  • 保留 volumes 字段作为别名(使用 @JsonProperty@JsonAlias),或
  • 同时保留两个字段,逐步过渡到新字段
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java` at line 5235,
The field rename from volumes to whiteList in KVMAgentCommands breaks backward
compatibility; restore compatibility by preserving the old name: add a
backward-compatible alias for the field (e.g., annotate the new List<VolumeTO>
whiteList with a JSON alias for "volumes" or reintroduce a volumes field and map
it to whiteList), or use the project's `@GrayVersion` pattern to mark the change
for phased rollout; update the KVMAgentCommands class to accept both "whiteList"
and "volumes" during deserialization so mixed-version agents/controllers keep
the GC whitelist intact.

@MatheMatrix MatheMatrix force-pushed the sync/haidong.pang/fix/ZSTAC-85164@@3 branch from 9099d7c to 3a999cf Compare May 14, 2026 08:43
public String mountPoint;
public boolean force;
public List<VolumeTO> volumes;
public List<VolumeTO> whiteList;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment from haidong.pang:

功能未发布,不需要考虑版本兼容性

@zstack-robot-2
Copy link
Copy Markdown
Collaborator Author

Comment from yaohua.wu:

Review: MR !9856 — ZSTAC-85164

Summary

零风险纯重命名 PR:把 GCPoolCmd.volumesList<VolumeTO>)改名为 whiteListList<String>),用于承载 GC 保留白名单的 volumeUuid 字符串集合。属本次三仓 fix(IO 本地缓存 GC 误删)中的协议字段层。

Findings

无 Critical / Warning。已审核要点:

  • 类型一致性 ✓List<String> 与上下游消费方匹配(utility 侧 whiteList: list[str];premium 侧 addAll(Q.New(VolumeCacheVO)...select(volumeUuid).listValues()) 返回 List<String>)。
  • 命名准确性 ✓whiteListvolumes 更直接表达"GC 保留白名单"语义;同时类型简化为 List<String> 避免为白名单协议引入不必要的 VolumeTO 结构。
  • 兼容性 ✓:CodeRabbit 提示后作者澄清"功能未发布,不需要考虑版本兼容性",target 分支 feature-5.5.6-local-cache 未释放,无线上灰度风险,不需 @JsonAlias / @GrayVersion 双字段过渡,处置合理。

关联 MR(@@3 联动,必须同批合入)

仓库 MR 角色
zstackio/zstack !9856 (本 MR) 协议字段定义:GCPoolCmd.whiteList: List<String>
zstackio/zstack-utility !7058 kvmagent 消费侧:schemas.whiteList: list[str]gc_pool 直接读 cmd.whiteList
zstackio/premium !13895 MN 生产侧:查询 Ready 状态 VolumeCacheVO,按 volumeUuid 字符串填 whiteList;并把 gcPool() 纳入 pool 同步链

合入顺序硬约束(任何单 MR 单独合入都会破坏跨仓 ABI):

  • 仅合入本 MR:premium 仍引用旧 volumes 字段会编译失败。
  • 仅合入 utility:MN 仍发 volumes、agent 看不到字段 → cmd.whiteList=Nonevolume_uuids=[] → 复现 Jira 原 bug 现象且 100% 触发。

由于源分支统一为 fix/ZSTAC-85164@@3、target 统一为 feature-5.5.6-local-cache,按 @@n 约定同批合入即可。

Coverage

  • 文件:1 个(plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java
  • 类型变更:List<VolumeTO>List<String> — 已端到端交叉验证
  • 目标分支无与本 MR 冲突的上游新提交(diverged_commits_count=0)

Verdict

APPROVED — 待与 !7058 / !13895 同批合入。


🤖 Robot Reviewer

Rename GCPoolCmd retain list from volumes to inUseCacheUuids.

Resolves: ZSTAC-85164

Change-Id: Ia72f68775819e5193375ba29f87a4efdfb45430c
@MatheMatrix MatheMatrix force-pushed the sync/haidong.pang/fix/ZSTAC-85164@@3 branch from 3a999cf to d08d744 Compare May 18, 2026 03:42
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java`:
- Line 5235: The field name in the KVMAgentCommands class uses inUseCacheUuids
but must follow the cross-repo protocol name whiteList; rename the public field
inUseCacheUuids to whiteList while keeping its type as List<String> (update any
references/usages of inUseCacheUuids accordingly, e.g., in serializers,
constructors, getters/setters, and any code that reads/writes this field) so the
agent will serialize/deserialize with the agreed contract.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml (via .coderabbit.yaml)

Review profile: CHILL

Plan: Pro

Run ID: 160de46a-d8be-451c-9716-6816db609a56

📥 Commits

Reviewing files that changed from the base of the PR and between 9099d7c and d08d744.

📒 Files selected for processing (1)
  • plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java

public String mountPoint;
public boolean force;
public List<VolumeTO> volumes;
public List<String> inUseCacheUuids;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

协议字段名与既定跨仓契约不一致,需改为 whiteList

Line 5235 当前为 inUseCacheUuids,与本 PR 目标及联动仓约定的 whiteList 不一致,会导致按 whiteList 读取的一侧拿不到保留列表,GC 行为可能回退为错误删除路径。建议此处字段名改为 whiteList(类型保持 List<String>)。

🔧 建议修改
-        public List<String> inUseCacheUuids;
+        public List<String> whiteList;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public List<String> inUseCacheUuids;
public List<String> whiteList;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java` at line 5235,
The field name in the KVMAgentCommands class uses inUseCacheUuids but must
follow the cross-repo protocol name whiteList; rename the public field
inUseCacheUuids to whiteList while keeping its type as List<String> (update any
references/usages of inUseCacheUuids accordingly, e.g., in serializers,
constructors, getters/setters, and any code that reads/writes this field) so the
agent will serialize/deserialize with the agreed contract.

@zstack-robot-1 zstack-robot-1 deleted the sync/haidong.pang/fix/ZSTAC-85164@@3 branch May 18, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants